package com.csthink.core.business.service;

import com.csthink.common.infrastructure.enums.OpSystemConfigKeyEnum;
import com.csthink.mysql.dto.OpSystemConfigDTO;
import com.csthink.mysql.entity.OpSystemConfig;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author <a href="mailto:security.2009@live.cn">Mars</a>
 * @since 2023-09-11
 */
public interface OpSystemConfigService {

    void initHotKeys();

    OpSystemConfig get(String key);

    OpSystemConfig get(OpSystemConfigKeyEnum systemConfigKey);

    /**
     * only used in op, other module call get(String key)
     *
     * @param key
     * @return
     */
    OpSystemConfig query(String key);

    void set(OpSystemConfigDTO config);

    void setNoAuth(String key, String value);

    List<OpSystemConfig> list(String key);

    void delete(String key);

    boolean isEnableSystemFeature(OpSystemConfigKeyEnum systemConfigKey);

    boolean isDisableSystemFeature(OpSystemConfigKeyEnum systemConfigKey);

    void sendHotKeyUpdateMessage(String type, String data);

    void flushAllLocalCache();

    void flushLocalCacheKey();

    boolean isAccountEnableFeature(String key, String accountId);

    boolean isAccountDisableFeature(String key, String accountId);

    Map<String, Boolean> listFeatures(String accountId, Set<OpSystemConfigKeyEnum> keys);

    List<OpSystemConfig> list(Set<OpSystemConfigKeyEnum> keys);
}
